
import React, { Component } from 'react';
import {HashRouter,Route,Switch,Redirect} from "react-router-dom"
import NotFound from './errorpage/404';
import BadGetaway from './errorpage/503';
import Login from './login';
import lazyload from "../utils/lazyload"
import MainCpt from './main';

class MainRoute extends Component {
    render() {
        return (
            <HashRouter>
                <Route component={AdminGolbalRoute}/>
            </HashRouter>
        );
    }
}

class AdminGolbalRoute extends Component{
    render(){
        return(
            <div className="main">
                <Switch>
                    <Route path="/" exact component={()=><Redirect to="/login"/>} />
                    <Route path="/login" component={Login} />
                    <Route path="/main" component={lazyload(()=>import("./main"))} />
                    {/* <Route path="/main" component={MainCpt} /> */}
                    <Route path="/404" component={NotFound} />
                    <Route path="/503" component={BadGetaway}  />
                    <Route component={()=><Redirect to="/404"/>} />
                </Switch>
            </div>
        )
    }
}

export default MainRoute;